package com.base;

public class ThreadLocalTest {
    public static void main(String[] args) {
        new Thread(){
            @Override
            public void run() {
                try {
                    TokenUtil.domain.set("A");
                    Thread.sleep(3000);
                    System.out.println("A:"+ TokenUtil.domain.get());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                super.run();
            }
        }.start();

        new Thread(){
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                    TokenUtil.domain.set("B");
                    Thread.sleep(3000);
                    System.out.println("B:"+ TokenUtil.domain.get());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                super.run();
            }
        }.start();
        new Thread(){
            @Override
            public void run() {
                try {
                    TokenUtil.domain.set("C");
                    Thread.sleep(1000);
                    System.out.println("C:"+ TokenUtil.domain.get());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                super.run();
            }
        }.start();
        new Thread(){
            @Override
            public void run() {
                try {
                    TokenUtil.domain.set("D");
                    Thread.sleep(4000);
                    System.out.println("D:"+ TokenUtil.domain.get());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                super.run();
            }
        }.start();
    }

}
